﻿//-----------------------------------------------------------------------
// <copyright>
// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
// </copyright>
//----------------------------------------------------------------------- 
using System.Linq;
using Fulcrum.WeakEventManager;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Fulcrum.UnitTests.WeakEventManager
{
    [DeploymentItem("WeakEventManagerConfig.xml")]
    [TestClass]
    public class WeakEventManagerXmlConfigurationReadTests
    {
        public WeakEventManagerXmlConfigurationReadTests()
        {
        }


        WeakEventManagerGeneratorXmlConfiguration config;

         [TestInitialize()]
         public void MyTestInitialize() 
         {
             this.config = new WeakEventManagerGeneratorXmlConfiguration("WeakEventManagerConfig.xml");
         }

        [TestMethod]
        public void ValidSecondWeakEventManagerName()
        {
            var weakEventManager = this.config.WeakEventManagers.ElementAt(1);

            Assert.AreEqual("SecondEventManager", weakEventManager.Name);
        }

        [TestMethod]
        public void ValidSecondWeakEventManagerEventSource()
        {
            var weakEventManager = this.config.WeakEventManagers.ElementAt(1);

            Assert.AreEqual("NavigationList", weakEventManager.EventSource);
        }

        [TestMethod]
        public void ValidSecondWeakEventManagerEventName()
        {
            var weakEventManager = this.config.WeakEventManagers.ElementAt(1);

            Assert.AreEqual("SelectedItemChanged", weakEventManager.EventName);
        }

        [TestMethod]
        public void ValidSecondWeakEventManagerEventArgs()
        {
            var weakEventManager = this.config.WeakEventManagers.ElementAt(1);

            Assert.AreEqual("PropertyChangedEventArgs<INavigationItem>", weakEventManager.EventArgs);
        }
        
    }
}
